<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>角色管理-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../static/css/font.css">
		<link rel="stylesheet" href="../../static/css/weadmin.css">
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">管理员管理</a>
        <a>
          <cite>角色管理</cite></a>
      </span>
			<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<div class="weadmin-body">
			<div class="layui-row">
				<form class="layui-form layui-col-md12 we-search">
					<div class="layui-inline">
						<input class="layui-input" placeholder="开始日" name="start" id="start">
					</div>
					<div class="layui-inline">
						<input class="layui-input" placeholder="截止日" name="end" id="end">
					</div>
					<div class="layui-inline">
						<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
				</form>
			</div>
			<div class="weadmin-block">
				<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
				<button class="layui-btn" onclick="WeAdminShow('添加角色','./role-add.html')"><i class="layui-icon"></i>添加</button>
				<span class="fr" style="line-height:40px">共有数据：88 条</span>
			</div>
			<table class="layui-hide" id="list"></table>
			<div id="page"></div>
		</div>
		<script src="../../lib/layui/layui.js" charset="utf-8"></script>
		<script src="../../static/js/eleDel.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" charset="utf-8">
    	layui.extend({
			myHttp : '{/}../../static/js/myHttp'
		});
		layui.use(['jquery', 'myHttp', 'table' ,'laypage'], function(){
			var $ = layui.jquery;
			var myHttp = layui.myHttp;
			var table = layui.table;
			var laypage = layui.laypage;
			$(function(){
				var token = localStorage.getItem("token");
				table.render({
					  elem: '#list'
					  ,method:'post'
					  ,contentType: 'application/json'
					  ,headers: {Authorization: token}
					  ,url: '/user/roleList'
					  ,cols: [[
					      {checkbox: true, fixed: true}
					      ,{field:'id', title: 'ID', width:80, sort: true, fixed: true}
					      ,{field:'name', title: '角色名'}
					      ,{field:'remarks', title: '描述'}
					      ,{field:'state', title: '状态'}
					      ,{field:'createTime', title: '创建时间' }
					    ]]
					  ,parseData: function(res){ //res 即为原始返回的数据
						//执行一个laypage实例
						  laypage.render({
						    elem: 'page' //注意，这里的 test1 是 ID，不用加 # 号
						    ,count: res.data.totalElements //数据总数，从服务端得到
						    ,limit: res.data.size
						  });
					    return {
					      "code": 0, //解析接口状态
					      "msg": res.msg, //解析提示文本
					      "data": res.data.content //解析数据列表
					    };
					  }
					});
				
				return false;
			});
		});
    	</script>
	</body>

</html>